#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2024/11/17 14:08
# @Author  : zy
# @File    : fn_tst.py
import random
from datetime import datetime
from random import randint
from uuid import uuid4
from fn_db import addressDB, addressFS, clearWasterRecordsDB, clearWasterRecordsFS as cwrsFS
from db.async_mongoDB import Work
import asyncio


def p_d_rnd():
    return {
        '_id': str(uuid4()),
        'point': f'point_name-{randint(1000, 2000)}',
    }


def cwr_rnd(fk):
    return {
        '_id': str(uuid4()),
        'fk': fk,
        'datetime': datetime(2025, randint(2, 8), randint(1, 28), 10, 35, 15),
        'w_total': randint(12, 150)
    }


if __name__ == '__main__':
    import asyncio

    ps = [p_d_rnd() for i in range(10)]
    fs = [b'this,is img_0', b'this,is img_1', b'this,is img_2']
    fs1 = [b'this,is  img_4', b'this,is  img_5', b'this,is img_6']

    cw = [cwr_rnd('46587') for i in range(10)]

    r=asyncio.run(clearWasterRecordsDB.insert_many(cw))
    print(r)
